// 绕开额外属性检验

interface MyInterface {
  name: string;
  age: number;
}
function getName(inter: MyInterface) {
  return inter.name;
}
getName({ name: "lwt", age: 1, a: 1 });

// 1 . 重新赋值
let inter = {
  name: "lwt",
  age: 1,
  a: 1,
};
getName(inter);

// 2. 类型断言
getName({ name: "lwt", age: 1, a: 1 } as MyInterface);
let inter2: MyInterface = {
  name: "lwt",
  age: 1,
  a: 1,
} as MyInterface;

// 3 . 索引签名
interface MyInterface2 {
  name: string;
  age: number;
  [propName: string]: any;  // 其他类型都必须是签名类型的子类型
}
let inter3: MyInterface2 = {
  name: "lwt",
  age: 1,
  xxx: 1,
};
